﻿using ConfExpert.Forms.Base;
using DevExpress.XtraGrid.Columns;
using DevTeam;
using System;
using System.Collections.Generic;

namespace ConfExpert.Forms.SatinAlma.YeniYapi
{
    public partial class HaftalikGelisler2 : XForm
    {
        public HaftalikGelisler2()
        {
            InitializeComponent();
        }

        List<string> lst = new List<string>();
        private void HaftalikGelisler2_Load(object sender, EventArgs e)
        {
            

            chkInterval.Edit.EditValueChanging += Edit_EditValueChanging;
            chkInterval.EditValue = "Hafta";
            gridView1.Init("GetHaftalikYukleme2", chkInterval.EditValue);
            Prep();
        }

        private void Prep()
        {
            lst.Clear();
            foreach (GridColumn col in gridView1.Columns)
                if (gridView1.Columns.IndexOf(col) > 3)
                    lst.Add(col.FieldName);

            gridView1.SetCaptions("0:Onaylanmamış/Beklemede");
            gridView1.FormatAsNumber(1, lst.ToArray());
            gridView1.AddSummary(lst.ToArray());
            gridView1.BestFitColumns();
            foreach (string col in lst)
                gridView1.Columns[col].Width = 54;
            gridView1.Columns["0"].BestFit();
        }

        void Edit_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
        {
            gridView1.Init("GetHaftalikYukleme2", e.NewValue.ToString());
            Prep();
        }
    }
}
